//
//  FeedsCollectionView.swift
//  HinsLive
//
//  Created by haoxian on 2019/4/30.
//  Copyright © 2019 Hins. All rights reserved.
//

import UIKit

class FeedsCollectionView: UICollectionView {
    
    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        let liveBtnCenter = CGPoint(x: width / 2, y: height + 17)
        let distanceX = fabs(Double(liveBtnCenter.x - point.x))
        let distanceY = fabs(Double(liveBtnCenter.y - point.y))
        let distance = sqrt(pow(distanceX, 2) + pow(distanceY, 2))
        if distance <= 32, let mianTabBar = UIApplication.shared.keyWindow?.rootViewController as? MainTabBarController {
            return mianTabBar.liveButton
        }
        return super.hitTest(point, with: event)
    }
}
